home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / demos / mastdemo.zoo / batch / toplink.bat < prev   
DOS Batch File  |  1990-03-22  |  2KB  |  90 lines

  1. :                TopLink
  2. :
  3. : Usage:    TopLink {<drive>}
  4. :
  5. : TopLink installs symbolic links to all toplevel directories on all of the
  6. : given drives or on all harddisks if we got no parameter.
  7. :
  8.  
  9. ifglobal UNIX {;} else {
  10.     set nounix
  11.     Unix                ; # if Unix-Mode inactive, enable it
  12. }
  13.  
  14. set drives $*
  15. ifempty drives {
  16. : Get all connected drives (without floppy A and B)
  17.     alldrives => drives        ; # all drives are displayed
  18.     if 'A' in drives {
  19.         cdr -2 drives => drives    ; # no A and B
  20.     }
  21. }
  22.  
  23. if drives != "" {
  24. : initialisation
  25.     cls
  26.     rem             TopLink
  27.     rem
  28.     rem TopLink installs links to the toplevel-directories of the harddisk.
  29.     rem then you can use all partitions like one single filesystem. We now
  30.     rem process the drives $drives.
  31.     rem
  32.     rem Please wait...
  33.     rem
  34.  
  35.     unset line            ; # formatted line of screen output
  36.     set inline 0            ; # number of words in line
  37.     pushd > NUL:            ; # save old directory
  38.  
  39. : process the next drive
  40. foreach drive in drives do
  41.     cd $drive:/ > NUL:        ; # go to toplevel-directory of drive
  42.     files -256d => dirnames        ; # directories without path to dirnames
  43. : process the next directory
  44.     foreach currentdir in dirnames do
  45.         files -dp $currentdir => currentpath
  46.         if not exec "ln /$currentdir => oldlink" {
  47.                     ; # test, wether we have a link already
  48.                     ; # if yes, ask the user
  49.             if oldlink = currentpath {
  50.                 continue; # it's the same anyway
  51.             }
  52.             beep
  53.             printf "\ej\eY( "
  54.             printf "\eL"
  55.             printf "\eLDirectory /$currentdir found twice:"
  56.             printf "\eL    old:    $oldlink"
  57.             printf "\eL    new:    $currentpath"
  58.             get "LOverwrite ? [J/N] " keypressed
  59.             printf "\eM\eA\eM\eA\eM\eA\eM\eA\eM\ek"
  60.             if keypressed = 'N' {
  61.                 continue    ; # next directory
  62.             }
  63.         }
  64.         ln /$currentdir $currentpath    ; # install a new link
  65.         printf "%14s" currentdir ==> currentdir; # format the output
  66.         set line $line$currentdir;    ; # and add an entry to line
  67.         increment inline        ; # one more
  68.         if inline = "5" {
  69.             rem $line;
  70.             set inline 0
  71.             unset line        ; # outpput line
  72.         }
  73.     endfor                    ; # to the next directory
  74. endfor                        ; # next drive
  75.  
  76.     : last actions
  77.     if line != "" {
  78.         rem $line;        ; # output one last line
  79.     }
  80.     popd > NUL:            ; # go back to the starting dir
  81.     rem
  82.     rem Done.
  83.     beep
  84. }
  85.  
  86. iflocal nounix {            ; # was Unix-mode inactive ?
  87.     Nounix
  88. }
  89. quit
  90.